<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>用户管理</title>
	<%@ include file="/view/common/tags.jsp"%>
	<script type="text/javascript" src="${sysManagerV1}/js/My97DatePicker/WdatePicker.js"> </script>
</head>
<body>
	<section class="content">
    	<div class="row">
            <div class="col-md-12">
                <div class="box">
                	<div class="box-body">
						<div class="panel panel-default">
                            <div class="panel-body" style="padding-bottom:5px;">
                            	<input id="freeNumRemainListJson" type="hidden" value="${freeNumRemainListJson}" >
                            	<input id="sourceListJson" type="hidden" value="${sourceListJson}" >
                                <form class="form-horizontal" action="" method="post" id="dataForm">
                                    <input type="hidden" id="token" name="token" value=""/>
                                	<div class="searchMenu">
                                	    <div>
                                		    <label>用户帐号：</label>
                                            <input type="text" class="form-control" name="wm[_LIKE$USER_ACCOUNT]" value="${page.wm._LIKE$USER_ACCOUNT}"  placeholder="请输入用户帐号">
                                        </div>
                                        <div>
                                           <label>注册时间：</label>
                                            <input id="createTimeStart" name="wm[_MORE_EQUAL$REG_TIME]" value="${page.wm._MORE_EQUAL$REG_TIME}"  type="text"  class="Wdate" 
											  onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',startDate:'%y-%M-%d 00:00:00',alwaysUseStartDate:true,maxDate:'#F{$dp.$D(\'createTimeEnd\')}',minDate:'#F{$dp.$D(\'createTimeEnd\',{d:-30,H:-23,m:-59,s:-59})}'})" /> 
											  <span class="pull-left">&nbsp;-&nbsp;</span>
											  <input id="createTimeEnd" name="wm[_LESS_EQUAL$REG_TIME]" value="${page.wm._LESS_EQUAL$REG_TIME}"  class="Wdate" 
								               onFocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',startDate:'%y-%M-%d 23:59:59',alwaysUseStartDate:true,minDate:'#F{$dp.$D(\'createTimeStart\')}',maxDate:'#F{$dp.$D(\'createTimeStart\',{d:+30,H:+23,m:+59,s:+59})}'})" />
                                        </div>
                                        <div class="mal10" >
                                            <button type="button"  class="btn btn-primary btn-sm"  onclick="findData()"><span class='glyphicon glyphicon-search'></span>查&nbsp;询</button>
                                        </div>
                                	</div>
                                </form>
                        	</div>
						</div>
                        <table class="table table-hover table-condensed table-bordered table-striped" id="dataTable" >
                            <thead>
                            	<tr>
                                	<th data-field="index" data-align="center" data-formatter="indexFormatter" data-sortable="false">序号</th>
                                	<th data-field="userAccount" data-align="center" data-formatter="userAccountFormatter" data-sortable="true">用户帐号</th>
                                	<th data-field="userRole" data-align="center" data-formatter="userRoleFormatter" data-sortable="true">用户角色</th>
                                	<th data-field="nickname" data-align="center" data-sortable="true">昵称</th>
                                	<th data-field="gameRole" data-align="center" data-sortable="true">游戏角色</th>
                                    <th data-field="balance" data-align="center" data-formatter="toDecimal" data-sortable="true">账户余额</th>
                                	<th data-field="matchAmount" data-align="center" data-sortable="true">参加比赛场次</th>
                                	<th data-field="winAmount" data-align="center" data-sortable="true">吃鸡总场次</th>
                                	<th data-field="winSum" data-align="center" data-sortable="true">获奖总金额</th>
                                	<th data-field="regTime" data-align="center" data-formatter="timeFormatter_point" data-sortable="true">注册时间</th>
                                    <!-- <th data-field="deleteButton" data-align="center" data-formatter="buttonFormatter" data-sortable="false">操作</th>  -->
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
       	</div>
	</section>
   <%@ include file="/view/common/footer.jsp"%>
</body>
<script>
//提示信息
var msgg='<%=request.getAttribute("msg")%>';
if (msgg && msgg!=null && msgg!='null') { 
      layer.msg(msgg);
}
var tableIndex = 0; // 添加修改的弹出框的ID

// 加载table 数据
$(function(){
    $("#token").val(sessionStorage.getItem("token"));
    
    $("#dataTable").bootstrapTable({ 
        url: "${userInfoV1}/pubgUser/data",
        method:"get", 
        contentType: "application/x-www-form-urlencoded",
        pagination:true,
        sidePagination:"server",
        queryParams: function(params) {
            //alert(JSON.stringify(params));
            return $.extend({}, params, parseJson(decodeURIComponent($("#dataForm").serialize())));     
        }
    });
})

// 查询
function findData(){
   $("#dataTable").bootstrapTable("refresh",{} ); 
} 

// 行点击事件
$(function(){
   $("body").on("click","table>tbody>tr",function(){
      $(this).css("background","#e1ecf1").siblings().css("background","");
   });
})

// 用户帐号 字段格式化
function userAccountFormatter(value, row) {
	return "<a href='javascript:void(0)' onclick='userDetail(" + row.rowId + ", \"" + value + "\")'>" + value + "</a>";
}

// 帐号类型字段格式化
function userRoleFormatter(value, row) {
    var html = "<span class='text-success'>队员 </span>";
    if (row.userRole == 20) {
        html = "<span class='text-warning'>队长</span>";
    } else if (row.userRole == 30) {
        html = "<span class='text-error'>部长 </span>";
    }
    return html;
}

// 用户详情
function userDetail(rowId, userAccount){
	layer.open({
        type: 2,
        title: "【" + userAccount + "】用户详情",
        closeBtn: 1,
        shadeClose: true,
        area: ['900px', '660px'],
        content: "${sysManagerV1}/userInfo/userDetail?rowId=" + rowId,
        btn: ["关 闭"],
        yes: function(index, layero){
        	layero.close();
        }
    });
}
</script>
</html>